---
title: Decide whether a record is sent to OnBase
summary: Evaluates document counts and value equality to decide whether a keyword-sync record is sent to OnBase.
status: draft
owner: Documents
last_reviewed: 2026-09-17
operation_id: OP-004
trigger: Step 3 of OP-003
---

# OP-004: Decide whether a record is sent to OnBase

For each unprocessed record, this operation resolves the prior and new keyword values, logs the decision context, and returns a send/skip decision based on document counts and value equality.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-004 |
| **Trigger** | Step 3 of [OP-003](sync-a-keyword-batch-with-onbase.md); returns the send/skip decision |
| **Lifecycle stage** | Execute |
| **Owning component** | `KeywordUpdater.PerformUpdate(ImageKeywordSync keyword, bool getDocumentCount)` |
| **Inputs** | One `ImageKeywordSync` record, the document-counting flag |
| **Outputs** | Boolean send/skip decision; a logged record-header block |
| **Failure exit code** | `5` — a null `OnBaseKeyword` throws `NullReferenceException`* |

## Steps

1. Resolve the prior value and the new value through [OP-006](translate-a-keyword-value.md) ([BR-OBKS-009](../business-rules.md#br-obks-009-flag-keyword-translation))
   - On failure: a null `OnBaseKeyword` throws `NullReferenceException`*
2. Log ID, trigger type (`ImageKeywordSync.TriggerType`), doc type group, keyword name, prior value, new value ([BR-OBKS-006](../business-rules.md#br-obks-006-trigger-type-and-query-keyword-derived-by-precedence))
3. If document counting is on **and** `TotalDocumentUpdates > 0`: log the count of updates with documents and the total document count, and return true ([BR-OBKS-004](../business-rules.md#br-obks-004-document-count-gates-whether-a-record-is-sent))
4. Else if prior and new values are equal case-insensitively: log that no updates will be sent, return false ([BR-OBKS-005](../business-rules.md#br-obks-005-equal-prior-and-new-values-are-not-sent))
5. Else if document counting is on (implying zero documents): log `"No documents to update"`, return false ([BR-OBKS-004](../business-rules.md#br-obks-004-document-count-gates-whether-a-record-is-sent))
6. Else return true — document counting off, send without checking document counts ([BR-OBKS-004](../business-rules.md#br-obks-004-document-count-gates-whether-a-record-is-sent))

Ordering finding: because step 3 is evaluated first, a record whose prior and new values are identical is still sent when document counting is on and documents exist — the equality short-circuit ([BR-OBKS-005](../business-rules.md#br-obks-005-equal-prior-and-new-values-are-not-sent)) only applies when document counting is off or no documents exist*.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
    A["Resolve prior/new values<br>via OP-006"] --> B["Log record header block"]
    B --> C{"Document counting on<br>AND TotalDocumentUpdates &gt; 0?"}
    C -->|Yes| D["Log update counts<br>return true - send"]
    C -->|No| E{"Prior value equals<br>new value?"}
    E -->|Yes| F["Log no updates needed<br>return false - skip"]
    E -->|No| G{"Document counting on?"}
    G -->|Yes| H["Log no documents<br>return false - skip"]
    G -->|No| I["Return true - send"]
```

## Logging

| Log id | Written content |
| --- | --- |
| Not application-assigned (fans out to all registered `file0`–`file4` writers) | Record ID, trigger type, doc type group, keyword name, prior value, new value, and either the update counts or the skip reason |

## Error handling
- A null `OnBaseKeyword` on the resolved record throws `NullReferenceException`, which propagates to `OnBaseKeywordSyncRunner.Execute`'s catch block → exit code `5`*.

## Related documentation
- [Run lifecycle](../run-lifecycle.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Operational runbook](../operational-runbook.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `OnBaseKeywordSync/Services/KeywordUpdater.cs`
- `OnBaseKeywordSync/Services/KeywordHelper.cs`
